<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <style>
        .test1{
            background-color: red;
            width: 300px;
            height: 400px;
            text-align: center;
            line-height: 400px;
        }
        span{
            background-color: purple;
        }
        .test2{
            background-color: green;
            width: 90px;
            /*auto只有水平方向好用*/
            margin: 0px auto;
            /*text-align: center;*/
        }

    </style>
</head>
<body>
    <div class="test1">
    <!--行内标签 span-->
        <!--<span>span</span>-->
        <!--行内块级标签-->
        <!--<button>百度一下</button>-->
        <!--块级标签-->
        <div class="test2">test2</div>
    </div>
</body>
</html>